struct Solution {}

fn main() {}

impl Solution {
    pub fn check_perfect_number(num: i32) -> bool {
        if num <= 1 {
            return false;
        }

        let mut arr: Vec<i32> = vec![];
        let mut num_cp: i32 = num;
        for n in 1..=(num_cp / 2 + 1) {
            if num % n == 0 {
                arr.push(n);
            }
        }
        arr.iter().sum::<i32>() == num
    }
}